home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 2000 #2 / Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO / startcd.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2000-03-28  |  8KB  |  281 lines

  1. #!/bin/sh 
  2. # Installation script for Sun Catalyst CDs
  3. #
  4. # Copyright 1997, SunSoft, Inc.
  5. #
  6. # Author: marc.sacoolas@sun.com 
  7. # Date: October 10, 1997
  8. # Last Modified 12-5-97
  9.  
  10. # initialize variables
  11. DISC_NAME=Sun_Solutions_CD-February_99
  12. ISSUE_NAME="Sun Solutions CD"
  13. ISSUE_DATE="Volume 2 2000"
  14. PORT_NUMBER=7999
  15.  
  16. export ISSUE_NAME ISSUE_DATE PORT_NUMBER
  17.  
  18. dir_exist=0
  19. echo ""
  20. echo "          $ISSUE_NAME $ISSUE_DATE initializing ..."
  21. echo ""
  22.                         
  23.  
  24.  
  25. # set CDMOUNT to path from the command line arguements
  26. CDMOUNT=`expr \
  27.         $0'/' : '\(/\)[^/]*//*$' \
  28.         \| $0'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \
  29.         \| .`
  30.  
  31. # if command line path is current directory then set CDMOUNT to pwd
  32. # CDMOUNT cannot be set to . because other programs/scripts
  33. # need the absolute path in CD_MOUNT
  34. if [ "$CDMOUNT" = "." ]; then
  35.         CDMOUNT=`pwd`
  36. fi
  37. CD_MOUNT=$CDMOUNT
  38. export CD_MOUNT DISC_DIR
  39.  
  40. #
  41. # os type and arch
  42. #
  43. check_os()
  44. ######################################################################
  45. {
  46.         os_ver="`/bin/uname -r | /bin/grep 5\[.]`"
  47.  
  48.         export os_ver
  49.  
  50.         if [ -n "$os_ver" ]; then
  51. # must be running Solaris 2.x
  52.                 machine_type="`/bin/uname -m`"
  53.                 os_type="`/bin/uname -r`"
  54.                 if [ "$machine_type" = "i86pc" ]; then
  55.                         OS_TYPE=""
  56.                         CDWARE_ENV=Solaris_x86
  57.                 else
  58. # must be on a SPARCarchitecture-based machine
  59.                         bcp="`/bin/pkginfo | /bin/grep SUNWbcp`"
  60. # check for bcp and set CDWARE_ENV accordingly???
  61.                         CDWARE_ENV=Solaris_2
  62.                 fi
  63.         else
  64. # must be running Solaris 1.x
  65.                 GUI=products/bin/Solaris_1/cdmanager
  66.                 GUI_BIN=cdmgr
  67.                 CDWARE_ENV=Solaris_1
  68.         test_sunos="`/bin/uname -r | /bin/grep 4.1.4`"
  69.         if [ -n "$test_sunos" ]; then
  70.             SUNOS_VER=4.1.4
  71.         else
  72.             SUNOS_VER=""
  73.         fi
  74.  
  75.         fi
  76.  
  77. }
  78.  
  79. check_os
  80. DISC_DIR="$CDMOUNT/products/bin/httpd/$CDWARE_ENV"
  81. export LD_LIBRARY_PATH CLASSPATH PATH JAVA_HOME DISC_DIR
  82.  
  83. LD_LIBRARY_PATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/lib:/usr/openwin/lib:/usr/lib:$LD_LIBRARY_PATH
  84. CLASSPATH=.:$CD_MOUNT/products/NetResultsCD:$CD_MOUNT/products/bin/gui/CDlaunch:$CD_MOUNT/products/bin/java/$CDWARE_ENV/lib/rt.jar:$CLASSPATH
  85.  
  86.  
  87.  
  88. JAVA_HOME=$CD_MOUNT/products/bin/java/$CDWARE_ENV
  89.  
  90. if [ "$OPENWINHOME" = "" ]; then
  91.     OPENWINHOME="/usr/openwin"; export OPENWINHOME    
  92. fi
  93. if [ "$HOME" = "" ]; then
  94.     
  95.         HOME="/"; export HOME
  96. fi
  97.  
  98. # set the dir where all the companies live
  99. PRODUCT_DIR=$CD_MOUNT/products
  100. export PRODUCT_DIR 
  101.  
  102. # get nodename
  103. NODENAME=`/bin/hostname`
  104.  
  105. if [ "$NODENAME" = "" ];then 
  106.     NODENAME = "localhost"
  107. fi
  108. export NODENAME
  109.  
  110. # legal, readme, etc.
  111.         #if [ "$CDWARE_ENV" != "Solaris_1" -a "$MARC" = "" ]; then
  112.                 #use starting java app
  113.                 #$CD_MOUNT/products/bin/java/$CDWARE_ENV/bin/jre CDaudio $CD_MOUNT/products/bin/gui/CDlaunch& 
  114.         #        $CD_MOUNT/products/bin/java/$CDWARE_ENV/bin/jre CDlaunch $CD_MOUNT/products/bin/gui/CDlaunch $DISC_DIR                                    
  115.         #else
  116.                # cat $CD_MOUNT/products/bin/gui/CDlaunch/license.txt
  117.         #fi
  118.  
  119. # exit if user has requested from CDlaunch; do clean-up
  120. #if [ -f $DISC_DIR/nostart ];then
  121. #    # kill sound
  122. #    if [ -r $DISC_DIR/sound.pid ]; then
  123. #        kill -9 `cat $DISC_DIR/sound.pid`
  124. #    fi
  125. #    rm -r $DISC_DIR
  126. #    exit 0
  127. #fi
  128.  
  129.         if [ "$CDWARE_ENV" != "Solaris_x86" ]; then
  130.     CLASSPATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/java_301:$CLASSPATH
  131.     else
  132.         CLASSPATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/java_30:$CLASSPATH
  133.     fi
  134.  
  135.  
  136. #if [ ! -h $DISC_DIR/products ]; then
  137. #        ln -s $PRODUCT_DIR $DISC_DIR
  138. #fi
  139. #
  140. #if [ ! -h $DISC_DIR/.cgi-bin ]; then
  141. #        ln -s $PRODUCT_DIR/.bin/httpd/$CDWARE_ENV $DISC_DIR/.cgi-bin
  142. #fi
  143. #
  144. #if [ ! -h $DISC_DIR/home ]; then
  145. #        ln -s $HOME $DISC_DIR/home
  146. #fi
  147.  
  148.  
  149. # get around read-only netresults problem
  150.  
  151.  
  152.  
  153. if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  154.     export XNLSPATH XKEYSYMDB
  155.     PATH=$DISC_DIR:/usr/ucb:$OPENWINHOME/bin:/usr/bin:/usr/sbin:$PATH
  156.     XNLSPATH=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/nls
  157.     XKEYSYMDB=$CD_MOUNT/products/bin/gui/$CDWARE_ENV/XKeysymDB
  158. else
  159.     OS_REV=`/bin/uname -r | $DISC_DIR/perl -n -e 's?^[0-9]\.([0-9]).*?\1? ? print : print "none";'`
  160.     PATH=$DISC_DIR:/usr/bin:$OPENWINHOME/bin:/usr/sbin:$PATH
  161. fi
  162.     export OS_REV
  163.  
  164. #    WWW_FIRST=http://$NODENAME:$PORT_NUMBER/index.html
  165. #    WWW_HOME=http://$NODENAME:$PORT_NUMBER/index.html
  166.     WWW_HOME=file://$CD_MOUNT/products/index.html
  167.     WWW_FIRST=file://$CD_MOUNT/products/index.html
  168.     WWW_FIRST=file://$CD_MOUNT/products/proxywarning.html
  169.     # so says Scott
  170.  
  171. export WWW_HOME WWW_FIRST CDWARE_ENV
  172.  
  173.     echo ""
  174.     echo "Launching Search Server..."
  175.     echo " "
  176.     #CWD=`pwd`
  177.     cd $CD_MOUNT/products/bin/gui/code
  178.         #$CD_MOUNT/products/bin/java2/$CDWARE_ENV/bin/java SCDServer -u 7999 $CD_MOUNT &
  179.         $CD_MOUNT/products/bin/java2/$CDWARE_ENV/bin/java SCDServer -u 7999 $CD_MOUNT/products &
  180.     server_process=$!
  181.     export server_process
  182.  
  183. #SunOS search provision TOAST
  184. #echo $server_process
  185. #exit 0
  186. #if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  187. #        ln -s /tmp/solcd/products/catalog/list.wais.html /tmp/solcd/list.link
  188. #        echo "No Search supported on SunOS"
  189. #else
  190. #        ln -s $PRODUCT_DIR/catalog/list.excite.html /tmp/solcd/list.link
  191. #fi
  192. #
  193.  
  194. search_netscape()
  195. ######################################################################
  196. {
  197. if [ "$NETSCAPE_CATALYST" = "" ]; then
  198. #    PATH=$PATH:$CD_MOUNT/products/bin/gui/$CDWARE_ENV
  199.     NETSCAPE_VERSION="`netscape -version 2>&1| $DISC_DIR/perl -n -e 's?\D*([0-9.]*).*?\1? ? print : print "none"'`"
  200. #echo "NETSCAPE_VERSION=$NETSCAPE_VERSION"
  201. #    
  202.     POST_VERSION_4=`echo $NETSCAPE_VERSION|$DISC_DIR/perl -n -e '/[4-9]\./ ? print "good" : print "bad"'`
  203. #echo "POST_VERSION_4=$POST_VERSION_4"
  204. #    #POST_VERSION_301=`echo $NETSCAPE_VERSION|$DISC_DIR/perl -n -e '/3\.(\d[1-9]|[2-9]\d)/ || /[4-9]\./ ? print "old" : print "good"'`
  205.     if [ $POST_VERSION_4 = "good" ];then
  206.         echo
  207.         echo "Netscape Navigator "$NETSCAPE_VERSION" will be used for the Sun Solutions CD"
  208.         echo ""
  209. #        #echo $PATH
  210.         NETSCAPE_CATALYST=`echo $PATH|$DISC_DIR/perl -n -e '
  211.             @DIRS=split(/:/);
  212.             foreach $dir (@DIRS) {
  213.                 $dir =~ s/\n//;
  214.                 if (-x "$dir/netscape" && -f _) {
  215.                     print "$dir/netscape\n";
  216.                     last;
  217.                 }
  218.             }'`
  219.         export NETSCAPE_CATALYST
  220.     fi
  221. fi
  222. }
  223.  
  224. search_ie()
  225. ######################################################################
  226. {
  227. if [ "$IE_CATALYST" = "" ]; then
  228. #    PATH=$PATH:$CD_MOUNT/products/bin/gui/$CDWARE_ENV
  229.     IE_VERSION="`iexplorer -version 2>&-| $DISC_DIR/perl -n -e 's?\D*([0-9.]*).*?\1? ? print : print "none"'`"
  230. #echo "IE_VERSION=$IE_VERSION"
  231. #    
  232.     POST_VERSION_4=`echo $IE_VERSION|$DISC_DIR/perl -n -e '/[4-9]\./ ? print "good" : print "bad"'`
  233. #echo "POST_VERSION_4=$POST_VERSION_4"
  234. #    #POST_VERSION_301=`echo $IE_VERSION|$DISC_DIR/perl -n -e '/3\.(\d[1-9]|[2-9]\d)/ || /[4-9]\./ ? print "old" : print "good"'`
  235.     if [ $POST_VERSION_4 = "good" ];then
  236.         echo
  237.         echo "Internet Explorer "$IE_VERSION" will be used for the Sun Solutions CD"
  238.         echo ""
  239. #        #echo $PATH
  240.         IE_CATALYST=`echo $PATH|$DISC_DIR/perl -n -e '
  241.             @DIRS=split(/:/);
  242.             foreach $dir (@DIRS) {
  243.                 $dir =~ s/\n//;
  244.                 if (-x "$dir/iexplorer" && -f _) {
  245.                     print "$dir/iexplorer\n";
  246.                     last;
  247.                 }
  248.             }'`
  249.         export IE_CATALYST
  250.         #echo "loop, IE_CATALYST=$IE_CATALYST"
  251.     fi
  252. fi
  253. }
  254.  
  255. search_netscape
  256. if [ "$NETSCAPE_CATALYST" = "" ]; then
  257.     search_ie
  258. fi
  259.  
  260. #echo "Please wait, $ISSUE_NAME $ISSUE_DATE is starting ..."
  261. #echo ""
  262.  
  263. if [ "$NETSCAPE_CATALYST" = "" -a "$IE_CATALYST" = "" ]; then
  264.     echo
  265.     echo
  266.     echo "Please enter the path to the DIRECTORY of either the Netscape or Internet Explorer version 4 or later executable:"
  267.     read user_path
  268. #echo "user_path=$user_path"
  269.     PATH=$PATH:$user_path
  270.  
  271.     search_netscape
  272.     if [ "$NETSCAPE_CATALYST" = "" ]; then
  273.         search_ie
  274.     fi
  275. fi
  276. #export CDWARE_ENV
  277.  
  278. $CD_MOUNT/products/bin/finish.sh &
  279. sleep 40
  280. exit 0
  281.